<template>
	<div>
		<van-search
        v-model="value"
        show-action
        placeholder="请输入搜索关键词"
        @search="onSearch"
      >
        <template #left>
          <div @click="router.push('/0')" role="button" tabindex="0" class="van-search__action">
			<div>城市</div>
		</div>
        </template>
        <template #action>
          <div @click="router.push('/user')" v-if="userId" >我的</div>
          <div @click="router.push('/login')" v-else>登录</div>
        </template>
      </van-search>
	</div>
</template>
<script setup lang='ts'>
import { ref } from 'vue';
import { useRouter } from 'vue-router';

// 引入userStore函数
import { useUserStore } from '@/store/userStore';
// 为了store中提取属性时保持其响应性，你需要使用 storeToRefs()
import { storeToRefs } from 'pinia';

const userStore = storeToRefs(useUserStore())
const { userId } = userStore

const router = useRouter()

const value = ref('')

const onSearch = () => {

}

const onClickButton = () => {

}



</script>
<style scoped>

</style>